package com.cy7;

import java.util.Comparator;
import java.util.TreeSet;

public class TreeSetDemo {
    public static void main(String[] args) {
//        TreeSet<Student> ts = new TreeSet<>(new Comparator<Student>() {
//            @Override
//            public int compare(Student o1, Student o2) {
//                int num = o2.getSum() - o1.getSum();
//                int num2 = num == 0 ? o2.getMath() - o1.getMath() : num;
//                int num3 = num2 == 0 ? o2.getName().compareTo(o1.getName()) : num2;
//                return num3;
//            }
//        });
//        ts.add(new Student("董美英",85,85));
//        ts.add(new Student("李红梅",84,89));
//        ts.add(new Student("张敏",90,95));
//        ts.add(new Student("张晓",95,95));
//        ts.add(new Student("唐艳",96,98));
//        ts.add(new Student("袁湘",98,99));
//        ts.add(new Student("陈勇",100,100));
//        ts.add(new Student("的老婆们：",99,99));
//        for (Student t : ts) {
//            System.out.println(t);
//        }
        TreeSet<Student> ts = new TreeSet<>();
        ts.add(new Student("董美英",85,85));
        ts.add(new Student("李红梅",84,89));
        ts.add(new Student("张敏",90,95));
        ts.add(new Student("张晓",95,95));
        ts.add(new Student("唐艳",96,98));
        ts.add(new Student("袁湘",98,99));
        ts.add(new Student("陈勇",100,100));
        ts.add(new Student("的老婆们：",99,99));
        for (Student t : ts) {
            System.out.println(t);
        }



    }
}
